package com.jm.product.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.fasterxml.jackson.annotation.JsonIgnore;


/**
 * 规格值Entity
 * @author sunshine
 * @version 2017-07-03
 */
@Entity
@Table(name = "es_spec_values")
@Cache(region = "com.jm.cache", usage = CacheConcurrencyStrategy.READ_WRITE)
public class SpecValues extends IdEntity<Integer> implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Column(name="spec_value")
	private String specValue;//规格值名称
    @Column(name="spec_image")
	private String specImage;//spec_image
    @Column(name="spec_order")
	private Integer specOrder;//spec_order
    @Column(name="spec_type")
	private String specType;//spec_type

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="spec_id")
    @JsonIgnore
    private Specification specification;

	public SpecValues() {
		super();
	}
	
	/**
	*
	* get 规格值名称
	*
	* return specValue
	*/
	public String getSpecValue() {
		return this.specValue;
	}
	
	/**
	 * 
	 * set 规格值名称
	 * 
	 * @param specValue
	 */
	public void setSpecValue(String specValue) {
		this.specValue = specValue;
	}
	/**
	*
	* get spec_image
	*
	* return specImage
	*/
	public String getSpecImage() {
		return this.specImage;
	}
	
	/**
	 * 
	 * set spec_image
	 * 
	 * @param specImage
	 */
	public void setSpecImage(String specImage) {
		this.specImage = specImage;
	}
	/**
	*
	* get spec_order
	*
	* return specOrder
	*/
	public Integer getSpecOrder() {
		return this.specOrder;
	}
	
	/**
	 * 
	 * set spec_order
	 * 
	 * @param specOrder
	 */
	public void setSpecOrder(Integer specOrder) {
		this.specOrder = specOrder;
	}
	/**
	*
	* get spec_type
	*
	* return specType
	*/
	public String getSpecType() {
		return this.specType;
	}
	
	/**
	 * 
	 * set spec_type
	 * 
	 * @param specType
	 */
	public void setSpecType(String specType) {
		this.specType = specType;
	}

    public Specification getSpecification() {
        return specification;
    }

    public void setSpecification(Specification specification) {
        this.specification = specification;
    }

	@Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        result = prime * result + ((specValue == null) ? 0 : specValue.hashCode());
        result = prime * result + ((specImage == null) ? 0 : specImage.hashCode());
        result = prime * result + ((specOrder == null) ? 0 : specOrder.hashCode());
        result = prime * result + ((specType == null) ? 0 : specType.hashCode());
        return result;
    }
	
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        SpecValues other = (SpecValues) obj;
        if (id == null) {
            if (other.id != null)
                return false;
        } else if (!id.equals(other.id))
            return false;
        if (specValue == null) {
            if (other.specValue != null)
                return false;
        } else if (!specValue.equals(other.specValue))
            return false;
        if (specImage == null) {
            if (other.specImage != null)
                return false;
        } else if (!specImage.equals(other.specImage))
            return false;
        if (specOrder == null) {
            if (other.specOrder != null)
                return false;
        } else if (!specOrder.equals(other.specOrder))
            return false;
        if (specType == null) {
            if (other.specType != null)
                return false;
        } else if (!specType.equals(other.specType))
            return false;
        return true;
    }
	
 	@Override
    public String toString() {
        return "SpecValues [id=" + id + ",specValue=" + specValue + ",specImage=" + specImage + ",specOrder=" + specOrder + ",specType=" + specType + "]";
    }
}


